<template>
  <!-- 项目分包-开票列表 5-2 -->
  <div>

    <div class="table-wrap" v-if="!billDetailShow">
      <div class="table-top">
        <a-input-search placeholder="请输入内容" v-model="search" class="search" @search="onSearch" />
        <a-button type="primary" class="buttonColorGreen ml10 mr10">查询</a-button>
        <a-button type="primary" class="buttonColorGreen ml10 mr10" @click="reset">重置</a-button>
      </div>
      <div class="table">
        <a-table :columns="columns" :dataSource="tableData" bordered>
          <span slot="details">
            <a-button type="primary" class="buttonColorGreen" @click="billDetailShow=true">
              <a-icon type="zoom-in" /> 详情
            </a-button>
          </span>
        </a-table>
      </div>
    </div>
    <billDetail v-if="billDetailShow" :billDetailShow.sync="billDetailShow"></billDetail>
  </div>

</template>

<script>
import billDetail from './billDetail'
const columns = [{   //表格表头
  title: '序号',
  dataIndex: 'number',
  scopedSlots: { customRender: 'number' },
},
{
  title: '分包合同编号',
  dataIndex: 'objectNum',
},
{
  title: '项目名称',
  className: 'objectName',
  dataIndex: 'objectName',
},
{
  title: '项目合同编号',
  dataIndex: 'objectNum',
},
{
  title: '签约金额',
  dataIndex: 'checkinTime',
},
{
  title: '累计开票次数',
  dataIndex: 'count',
},
{
  title: '累计开票金额',
  dataIndex: 'checkinTime',
},
{
  title: '累计付款金额',
  dataIndex: 'checkinTime',
},
{
  title: '应付账款',
  dataIndex: 'checkinTime',
},
{
  title: '剩余付款金额',
  dataIndex: 'checkinTime',
},
{
  title: '  ',
  scopedSlots: { customRender: 'details' },
}
];

const tableData = [//表格数据
  {
    number: '1',
    objectName: '南昌县A项目',
    objectNum: '300,000.00',
    checkinTime: '500.000',
    count: 2,
    objectType: '软件型',
    customUnit: '国土局'
  },
  {
    number: '2',
    objectName: '南昌县A项目',
    objectNum: '1,256,000.00',
    checkinTime: '500.000',
    count: 3,
    objectType: '软件型',
    customUnit: '国土局'
  },
  {
    number: '3',
    objectName: '南昌县A项目',
    objectNum: '120,000.00',
    checkinTime: '500.000',
    count: 3,
    objectType: '软件型',
    customUnit: '国土局'
  }
];

export default {
  components: {
    billDetail
  },
  data() {
    return {
      tableData,
      columns,
      search: '',
      billDetailShow: false
    }
  },
  methods: {
    onSearch() {   //搜索

    },
    onDelete(key) {  //删除
      const dataSource = [...this.dataSource]
      this.dataSource = dataSource.filter(item => item.key !== key)
    },
    reset() {  //重置
      this.search = ""
    },
  }
}
</script>
